<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<form action="search_videos.html" method="post">
	<table cellpadding="0" cellspacing="0" border="0" align="center">
			<tr>
			<td></td>
			<td colspan="4" align="left">
			Enter keywords:&nbsp;<input type="text" name="txtkeyword" class="box" style="width: 200px;"/>
			<select name="txtcat">
				<option value="0">All Categories</option>
				<c:forEach var="y" begin="0" end="${fn:length(categories)-1 }" step="1" varStatus="status">
					<option value="${categories[y].CATEGORY_ID}">
						<c:out value="${categories[y].CATEGORY_NAME}"></c:out>
					</option>
				</c:forEach>
				
			</select>
			<input type="submit" value="Search" style="background-color: #006A9D;border: solid 1px #444;color: #C5C5C5;">
			</td>
		</tr>
		<tr><td colspan="5">&nbsp;</td></tr>
		<tr>
		<td width="25"> </td>
		<td colspan="4" valign="middle" align="left" height="25" class="titlebar"><b>&nbsp;&nbsp;More Videos</b></td>
		</tr>
		<tr><td colspan="5">&nbsp;</td></tr>
	<c:forEach var="x" begin="1" end="${rownum}" step="1" varStatus ="status">
		<tr valign="top">
			<td width="15"> </td>
			<c:forEach var="i" begin="${(x*4)-4}" end="${(x*4)-1}" step="1" varStatus ="status">
				<c:if test="${i>=StartingRow && i<=EndingRow}">
					<td height="150" width="180" align="left">
						<c:if test="${i<=fn:length(morevideos)-1 }">
							<a href="play_video.html?video_id=${morevideos[i].FILE_ID}"><img src="${morevideos[i].IMAGE_PATH}${morevideos[i].IMAGE_NAME}" height=100px width=150px></a><br>
							<a href="play_video.html?video_id=${morevideos[i].FILE_ID}"><c:out value="${morevideos[i].FILE_TITLE}"></c:out></a><br/>
							<span style="font-size: 9px;color: #444;"><b><c:out value="${morevideos[i].VIEW_NUMBER}"></c:out> views</b></span>
						</c:if>
					</td>
				</c:if>
			</c:forEach>
		</tr>
	</c:forEach>
	<tr>
		<td colspan="5" height="30" valign="top">
		<c:if test="${PageCount>1}">
			<c:if test="${page>1}">
				<a href="more_videos.html?page=${page-1}">Previous</a>
			</c:if>
			<c:if test="${page<=1}">
				<label style="color: #333">Previous</label>
			</c:if>
			
				<c:forEach var="i" begin="1" end="${PageCount}" step="1" varStatus ="status">
					<c:if test="${i==page}">
						<b style="color: #333"><c:out value="${i}" /></b>
					</c:if>
					<c:if test="${i!=page}">
						<a href="more_videos.html?page=${i}"><c:out value="${i}" /></a>
					</c:if>
				</c:forEach>
				
			<c:if test="${page<PageCount}">
				<a href="more_videos.html?page=${page+1}">Next</a>
			</c:if>
			<c:if test="${page>=PageCount}">
				<label style="color: #333">Next</label>
			</c:if>
		</c:if>
		</td>
	</tr>
		<tr><td colspan="5">&nbsp;</td></tr>
</table>
</form>
</body>
</html>